package com.my.internetplus.service;

import com.my.internetplus.dao.UserDao;
import com.my.internetplus.model.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserService {

    @Resource
    private UserDao userDao;

    public User selectUserByOpenId(String openid){
        User user = userDao.selectUserByOpenId(openid);
        if (user==null){
            userDao.insertUserByOpenId(openid);
            user=userDao.selectUserByOpenId(openid);
        }
        return user;
    }
}
